﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WEPMlibrary_Model;
using System.Data.SqlClient;
using System.Configuration;
using System.Data;
namespace WEPMconnection_DAL
{
    public class ProjectsypesDal
    {
        Conntion Con = new Conntion();
        /// <summary>
        /// 显示类型
        /// </summary>
        /// <returns></returns>
        public List<Projectsypes> showType()
        {
            List<Projectsypes> list = new List<Projectsypes>();
            using (SqlConnection conn =Con.Con())
            {
                try
                {
                    conn.Open();
                    StringBuilder str = new StringBuilder();
                    str.AppendLine("select id,ProjectTType from Projectsypes");
                    SqlDataAdapter adapter = new SqlDataAdapter(str.ToString(), conn);
                    DataTable dt = new DataTable();
                    adapter.Fill(dt);
                    foreach (DataRow dr in dt.Rows)
                    {
                        Projectsypes pro = new Projectsypes();
                        pro.id = Convert.ToInt32(dr["id"]);
                        pro.ProjectTType = dr["ProjectTType"].ToString();
                        list.Add(pro);
                    }
                }
                catch (Exception)
                {

                    throw;
                }
                finally
                {
                    conn.Close();
                }

            }
            return list;
        }
    }
}
